function isValidate(str) {
    let map = { "{": "}", "[": "]", "(": ")" };
    let temp = []
    for (let i = 0; i < str.length; i++) {
        if (temp[temp.length - 1] == str[i]) {
            temp.pop();
        } else {
            temp.push(map[str[i]])
        }

    }
    return temp.length == 0

}


console.log(isValidate("()()"))